Commit 47c1d55f659c02794fd5ed48b34c2a3532100227

Authored by zhangzzzz
1 parent 35b66650

重新集成成品组装功能;

src/mes/productionExec/productionExecMain/index.js
... ... @@ -31,7 +31,8 @@ const list = [
31 31 { sName: "qztable0", sGrd: "qztable0" }, // 切纸生产执行
32 32 { sName: "jytable0", sGrd: "jytable0" }, // 胶印生产执行
33 33 { sName: "wytable0", sGrd: "wytable0" }, // 凹印生产执行
34   - { sName: "wytgtable0", sGrd: "wytgtable0" } // 凹印挑规生产执行
  34 + { sName: "wytgtable0", sGrd: "wytgtable0" }, // 凹印挑规生产执行
  35 + { sName: "zztable0", sGrd: "zztable0" }
35 36 ];
36 37  
37 38 const useProductionExecMainEvent = props => {
... ... @@ -68,6 +69,8 @@ const useProductionExecMainEvent = props => {
68 69 ? list
69 70 : list.filter((_, index) => iInterface == index);
70 71  
  72 + listFilter.push({ sName: "zztable0", sGrd: "zztable0" });
  73 +
71 74 // 页面表明和配置表名对应关系
72 75 const tableNameCompareJson = {};
73 76 [...listFilter, ...props.execListExtra].forEach(item => {
... ... @@ -410,11 +413,19 @@ const ProductionExecMain = baseProps => {
410 413 const { app = {} } = baseProps;
411 414  
412 415 const [refreshCount, setRefreshCount] = useState(0);
  416 + const [sStatusNew, setStatusNew] = useState(undefined);
413 417  
414 418 useEffect(() => {
415 419 const getValue = () => {
416 420 const changeExecInfo = commonUtils.getAppData("changeExecInfo");
417   - if (changeExecInfo.dReplyPalletERp === 1) {
  421 + setStatusNew(changeExecInfo.sStatus);
  422 +
  423 + const refreshExecInfo = commonUtils.getAppData("refreshExecInfo");
  424 + if (refreshExecInfo.dReplyPalletERp === 1) {
  425 + commonUtils.setAppData("refreshExecInfo", {
  426 + ...refreshExecInfo,
  427 + dReplyPalletERp: 0
  428 + });
418 429 props.onRefresh();
419 430 setRefreshCount(pre => pre + 1);
420 431 }
... ... @@ -504,6 +515,7 @@ const ProductionExecMain = baseProps => {
504 515 {...props}
505 516 changeExecInfo={app.changeExecInfo}
506 517 refreshCount={refreshCount}
  518 + sStatusNew={sStatusNew}
507 519 />
508 520 )}
509 521 </div>
... ... @@ -534,7 +546,8 @@ const ProductionExecContentByType = props =&gt; {
534 546 deviceTargetInfoConfig = {},
535 547 deviceTargetInfoData = [],
536 548 setPagesLoading,
537   - refreshCount = 0
  549 + refreshCount = 0,
  550 + sStatusNew
538 551 } = props;
539 552  
540 553 /**
... ... @@ -584,7 +597,7 @@ const ProductionExecContentByType = props =&gt; {
584 597  
585 598 return showValue[flag];
586 599 },
587   - [deviceTargetInfoConfig, deviceTargetInfoData]
  600 + [deviceTargetInfoConfig, deviceTargetInfoData, sStatusNew]
588 601 );
589 602  
590 603 props = { ...props, sStatusNameProcess };
... ... @@ -595,11 +608,15 @@ const ProductionExecContentByType = props =&gt; {
595 608 return "";
596 609 }
597 610  
598   - const type0 =
  611 + let type0 =
599 612 window.execTest && productionExecType
600 613 ? productionExecType
601 614 : `type${iInterface === 0 ? "" : iInterface - 1}`;
602 615  
  616 + if (props.workOrderInfoData?.[0]?.bZZ) {
  617 + type0 = "type10";
  618 + }
  619 +
603 620 const type = `${type0}-${refreshCount}`;
604 621  
605 622 const content = {
... ... @@ -613,7 +630,8 @@ const ProductionExecContentByType = props =&gt; {
613 630 type6: <ProductionExecContent6 {...props} key={type} />,
614 631 type7: <ProductionExecContent7 {...props} key={type} />,
615 632 type8: <ProductionExecContent8 {...props} key={type} />,
616   - type9: <ProductionExecContent9 {...props} key={type} />
  633 + type9: <ProductionExecContent9 {...props} key={type} />,
  634 + type10: <ProductionExecContent10 {...props} key={type} />
617 635 };
618 636  
619 637 return content[type0] || "";
... ... @@ -915,10 +933,32 @@ const ProductionExecContent0 = props =&gt; {
915 933 const viewConfigs = config.gdsconfigformslave
916 934 .filter(item => item.bControl && item.sControlName.indexOf("Btn") === -1)
917 935 // .filter((_, index) => index < 8)
918   - .map(item => ({
919   - ...item,
920   - iColValue: 24
921   - }));
  936 + .map(item => {
  937 + const addState = {};
  938 + if (item.sName === "dReportQty") {
  939 + if (
  940 + props.workOrderInfoData?.[0]?.sProcessName?.includes("切纸") ||
  941 + props.workOrderInfoData?.[0]?.sProcessName?.includes("胶印") ||
  942 + props.workOrderInfoData?.[0]?.sProcessName === "大切张F"
  943 + ) {
  944 + addState.showName = `${item.showName}(张)`;
  945 + } else if (
  946 + ["大模压F", "UV模压F", "蒸镀F", "大分条F", "贴合F"].includes(
  947 + props.workOrderInfoData?.[0]?.sProcessName
  948 + )
  949 + ) {
  950 + addState.showName = `${item.showName}(米)`;
  951 + } else {
  952 + addState.showName = `${item.showName}(个)`;
  953 + }
  954 + }
  955 +
  956 + return {
  957 + ...item,
  958 + ...addState,
  959 + iColValue: 24
  960 + };
  961 + });
922 962  
923 963 const viewRow =
924 964 (selectedRowKeys[0]
... ... @@ -981,6 +1021,12 @@ const ProductionExecContent0 = props =&gt; {
981 1021 });
982 1022 return;
983 1023 }
  1024 +
  1025 + props.onTableBtnClick({
  1026 + name: tableName,
  1027 + record: viewRow,
  1028 + config: btnConfig
  1029 + });
984 1030 }
985 1031 };
986 1032 };
... ... @@ -2111,6 +2157,251 @@ const ProductionExecContent9 = props =&gt; {
2111 2157 );
2112 2158 };
2113 2159  
  2160 +// 类型10-成品组装
  2161 +const ProductionExecContent10 = props => {
  2162 + const tableName = "zztable0";
  2163 + const tableTypes = commonBusiness.getTableTypes(tableName, props);
  2164 + const {
  2165 + config: configOld = {},
  2166 + data = [],
  2167 + selectedRowKeys = [],
  2168 + name
  2169 + } = tableTypes;
  2170 + const config = props.onMergeTableConfig(configOld);
  2171 + const sIdGroupStr = data.map(item => item.sId).toString();
  2172 +
  2173 + const timer = useRef(null);
  2174 + useEffect(
  2175 + () => {
  2176 + if (!data.length) return;
  2177 + // 让第一条选中
  2178 + clearTimeout(timer.current);
  2179 + timer.current = setTimeout(() => {
  2180 + props.onSaveState({
  2181 + [`${tableName}SelectedRowKeys`]: [data[0].sId]
  2182 + });
  2183 + }, 200);
  2184 + },
  2185 + [sIdGroupStr]
  2186 + );
  2187 +
  2188 + const tableProps = {
  2189 + ...tableTypes,
  2190 + footer: "hidden", // 合计栏
  2191 + tableProps: {}
  2192 + };
  2193 +
  2194 + const viewConfigs = config.gdsconfigformslave
  2195 + .filter(item => item.bControl && item.sControlName.indexOf("Btn") === -1)
  2196 + .map(item => ({
  2197 + ...item,
  2198 + iColValue: 24
  2199 + }));
  2200 +
  2201 + const viewRow =
  2202 + (selectedRowKeys[0]
  2203 + ? data.find(item => item.sId === selectedRowKeys[0])
  2204 + : data[0]) || {};
  2205 +
  2206 + const viewProps = {
  2207 + ...props,
  2208 + viewConfigs,
  2209 + tableConfig: config,
  2210 + iColValueView: 24,
  2211 + viewRow,
  2212 + tableName: name,
  2213 + enabled: commonUtils.isNotEmptyObject(viewRow)
  2214 + };
  2215 +
  2216 + const btnProps = {
  2217 + type: "primary",
  2218 + size: "large",
  2219 + style: { width: 80 }
  2220 + };
  2221 +
  2222 + const getBtnConfigByControlName = sControlName => {
  2223 + const btnConfig =
  2224 + config.gdsconfigformslave.find(
  2225 + item => item.sControlName === sControlName
  2226 + ) || {};
  2227 + return {
  2228 + ...btnConfig,
  2229 + disabled: props.onGetBtnStatus(tableName, btnConfig),
  2230 + onClick: async () => {
  2231 + if (!props.onGetBtnContinue()) return;
  2232 + await props.awaitPromiseReturn();
  2233 + const { sButtonParam, sInstruct } = btnConfig;
  2234 + // 调用指令集
  2235 + if (sInstruct) {
  2236 + props.onExecInstructSet({
  2237 + ...props,
  2238 + btnConfig,
  2239 + tableLineParams: {
  2240 + name: tableName,
  2241 + record: viewRow,
  2242 + index: data.findIndex(item => item.sId === viewRow.sId)
  2243 + }
  2244 + });
  2245 + return;
  2246 + }
  2247 + // 调用存储过程
  2248 + if (sButtonParam) {
  2249 + props.onProcedureCall({
  2250 + btnConfig,
  2251 + onSuccess: () => {
  2252 + props.onRefresh && props.onRefresh();
  2253 + },
  2254 + onConfirm: () => {},
  2255 + onError: () => {}
  2256 + });
  2257 + return;
  2258 + }
  2259 +
  2260 + props.onTableBtnClick({
  2261 + name: tableName,
  2262 + record: viewRow,
  2263 + config: btnConfig
  2264 + });
  2265 + }
  2266 + };
  2267 + };
  2268 +
  2269 + const operationBarProps = {
  2270 + ...props,
  2271 + sName: name,
  2272 + bCostom: true,
  2273 + onRefresh: props.onRefresh // 刷新页面
  2274 + };
  2275 +
  2276 + const btnTableList = [
  2277 + "palletBatchMaterial",
  2278 + "workerOrderBatchMaterial",
  2279 + "assembletray"
  2280 + ];
  2281 + const formDataNew = props.formData.filter(
  2282 + item => item.sGrd && btnTableList.includes(item.sGrd)
  2283 + );
  2284 +
  2285 + const { workOrderInfoData = [] } = props;
  2286 + const commonModelProps = {
  2287 + ...props,
  2288 + costomModal: true,
  2289 + formData: formDataNew,
  2290 + sFilterConditions: {
  2291 + // sId: selectedRowKeys[0],
  2292 + sSrcSlaveId: workOrderInfoData[0]?.sWorkOrderId,
  2293 + sProductId: workOrderInfoData[0]?.sProductId
  2294 + }
  2295 + // noGetData: !selectedRowKeys.length
  2296 + };
  2297 +
  2298 + return (
  2299 + <div className={styles.type1}>
  2300 + <div className="topPart">
  2301 + <div className="type1Content">
  2302 + <div className="leftTable">
  2303 + <StaticEditTable {...tableProps} />
  2304 + </div>
  2305 + <div className="rightForm">
  2306 + <CommonViewTable className="rightFormBox" {...viewProps} />
  2307 + <div className="rightFormBtn">
  2308 + <div className="rightFormBtnFloor">
  2309 + <Space>
  2310 + <Button
  2311 + {...btnProps}
  2312 + {...getBtnConfigByControlName("BtnEventBlanking")}
  2313 + >
  2314 + 下料
  2315 + </Button>
  2316 + </Space>
  2317 + <Space>
  2318 + <Button
  2319 + {...btnProps}
  2320 + {...getBtnConfigByControlName("BtnScrapDesc")}
  2321 + style={{ width: 112, display: "block" }}
  2322 + >
  2323 + 废品登记
  2324 + </Button>
  2325 +
  2326 + <Button
  2327 + {...btnProps}
  2328 + {...getBtnConfigByControlName("BtnPrint2")}
  2329 + style={{ display: "none" }}
  2330 + >
  2331 + 下料
  2332 + </Button>
  2333 + {/* <Button {...btnProps}>产品②</Button> */}
  2334 + </Space>
  2335 + </div>
  2336 + <div className="rightFormBtnFloor">
  2337 + <Space className="leftPart">
  2338 + <Button
  2339 + className="abnormalBtn"
  2340 + style={{ "border-color": "#faad14", background: "#faad14" }}
  2341 + {...btnProps}
  2342 + {...getBtnConfigByControlName("BtnCancel")}
  2343 + >
  2344 + 撤销
  2345 + </Button>
  2346 + </Space>
  2347 + <Space className="rightPart">
  2348 + <Button
  2349 + {...btnProps}
  2350 + {...getBtnConfigByControlName("BtnPrint3")}
  2351 + style={{ display: "none" }}
  2352 + >
  2353 + 异常③
  2354 + </Button>
  2355 + {/* <Button {...btnProps}>撤销</Button> */}
  2356 + </Space>
  2357 + </div>
  2358 + <div className="rightFormBtnFoot pagesNuxt">
  2359 + <Button
  2360 + onClick={() => props.onPagesNuxt(tableName, "up")}
  2361 + icon={<LeftOutlined />}
  2362 + {...btnProps}
  2363 + />
  2364 + <Button
  2365 + onClick={() => props.onPagesNuxt(tableName, "next")}
  2366 + icon={<RightOutlined />}
  2367 + {...btnProps}
  2368 + />
  2369 + {[""].map(() => {
  2370 + const sControlName = "BtnRight1.BtnPrint4";
  2371 + const btnConfig = config.gdsconfigformslave.find(
  2372 + item => item.sControlName === sControlName
  2373 + );
  2374 + if (!btnConfig) return "";
  2375 +
  2376 + return (
  2377 + <Button
  2378 + {...btnProps}
  2379 + {...getBtnConfigByControlName(sControlName)}
  2380 + className={`${styles.print4} print4`}
  2381 + // style={{display: 'none'}}
  2382 + >
  2383 + 打印标条
  2384 + {/* {btnConfig.showName} */}
  2385 + </Button>
  2386 + );
  2387 + })}
  2388 + </div>
  2389 + </div>
  2390 + </div>
  2391 + </div>
  2392 + <div className="btns">
  2393 + <CommonOperationBarComponent {...operationBarProps} />
  2394 + </div>
  2395 + </div>
  2396 + <div className="bottomPart">
  2397 + <div className="commonModel commonModel1">
  2398 + <CommonModelComponent {...commonModelProps} />
  2399 + </div>
  2400 + </div>
  2401 + </div>
  2402 + );
  2403 +};
  2404 +
2114 2405 // 成品不良类比弹窗
2115 2406 const BllbModalComponent = props => {
2116 2407 const { bllbVisible, setBllbVisible } = props;
... ...