|
|
@ -2158,7 +2158,7 @@ func (impl *CustOrderServiceImplement) PageSelect(user *global.User, urlParamete |
|
|
|
pageNumberStr := urlParameters["pageNumber"] |
|
|
|
pageSizeStr := urlParameters["pageSize"] |
|
|
|
projectId := urlParameters["projectId"] |
|
|
|
productFamilyId := urlParameters["productFamilyId"] |
|
|
|
productFamilyId := urlParameters["productFamilyId"] |
|
|
|
pageNumber, err := strconv.Atoi(pageNumberStr) |
|
|
|
if err != nil { |
|
|
|
pageNumber = 1 |
|
|
@ -2845,22 +2845,48 @@ func (impl *CustOrderServiceImplement) CountTarget(user *global.User) (model.Tar |
|
|
|
if err != nil { |
|
|
|
return result, err |
|
|
|
} |
|
|
|
if len(serialList) == 0 { |
|
|
|
continue |
|
|
|
} |
|
|
|
//台套对应的派生数量
|
|
|
|
serialNUM := len(serialList) |
|
|
|
// 记录生产每个台套下面的工单数量
|
|
|
|
syncKeyMap := make(map[string][]omModel.SerialOrder) |
|
|
|
|
|
|
|
var orders []string |
|
|
|
for _, v := range serialList { |
|
|
|
orders = append(orders, v.SerialOrderId) |
|
|
|
syncKeyMap[v.SyncKey] = append(syncKeyMap[v.SyncKey], v) |
|
|
|
} |
|
|
|
//查询进去包装并且包装状态等于80的派生个数
|
|
|
|
packList,err :=packDao.SelectListByOrders(orders) |
|
|
|
packList, err := packDao.SelectListByOrders(orders) |
|
|
|
if err != nil { |
|
|
|
return result, err |
|
|
|
} |
|
|
|
//派生对应的打包数量
|
|
|
|
packNum :=len(packList) |
|
|
|
if serialNUM <= packNum{ |
|
|
|
result.Target += 1 |
|
|
|
if len(packList) == 0 { |
|
|
|
continue |
|
|
|
} |
|
|
|
//构建包装单map数组
|
|
|
|
packMap := make(map[string]string) |
|
|
|
for _, v := range packList { |
|
|
|
packMap[v.SerialOrderId] = v.SerialOrderId |
|
|
|
} |
|
|
|
//统计数量
|
|
|
|
for _, serialOrders := range syncKeyMap { |
|
|
|
isPack := true |
|
|
|
for _, vv := range serialOrders { |
|
|
|
key := vv.SerialOrderId |
|
|
|
_, ok := packMap[key] |
|
|
|
if !ok { |
|
|
|
isPack = false |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
if isPack { |
|
|
|
result.Target += 1 |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
return result, nil |
|
|
|
} |
|
|
@ -3055,11 +3081,11 @@ func (impl *CustOrderServiceImplement) SelectPic1(user *global.User, ) (result * |
|
|
|
delete(productFamilyMeterMap, deleteKey) |
|
|
|
} |
|
|
|
result = &model.CutLine1{ |
|
|
|
TimeLi: make([]string, 0, now.Hour()), |
|
|
|
TimeLi: make([]string, 0, now.Hour()), |
|
|
|
ProductFamilyMeter: productFamilyMeterMap, |
|
|
|
} |
|
|
|
for _, num = range dateTimeLi { |
|
|
|
result.TimeLi = append(result.TimeLi, strconv.Itoa(num) + "时") |
|
|
|
result.TimeLi = append(result.TimeLi, strconv.Itoa(num)+"时") |
|
|
|
} |
|
|
|
for productFamilyId, accomplishTimeMap := range productFamilyAccomplishMap { |
|
|
|
percentData := model.ProductFamilyProduce{ |
|
|
@ -3069,7 +3095,7 @@ func (impl *CustOrderServiceImplement) SelectPic1(user *global.User, ) (result * |
|
|
|
qty, exist := accomplishTimeMap[num] |
|
|
|
if exist { |
|
|
|
meter := productFamilyMeterMap[productFamilyId] |
|
|
|
percent := (float64(3600/qty)) / float64(meter) / 100 |
|
|
|
percent := (float64(3600 / qty)) / float64(meter) / 100 |
|
|
|
percentData.PercentLi = append(percentData.PercentLi, fmt.Sprintf("%.2f", percent)) |
|
|
|
} else { |
|
|
|
percentData.PercentLi = append(percentData.PercentLi, "0.00") |
|
|
@ -3109,7 +3135,6 @@ func (impl *CustOrderServiceImplement) SelectPic1(user *global.User, ) (result * |
|
|
|
|
|
|
|
return result, nil |
|
|
|
|
|
|
|
|
|
|
|
//packDao := jitDal.NewPackOrderDAO(session, user.PlantNr, user.UserId)
|
|
|
|
//
|
|
|
|
////图例001
|
|
|
@ -3748,7 +3773,7 @@ func (impl *CustOrderServiceImplement) AnalysisPlanFromExcel(user *global.User, |
|
|
|
if err != nil { |
|
|
|
return grmi.NewBusinessError("读取Sheet1页失败, error:" + err.Error()) |
|
|
|
} |
|
|
|
today, _ := time.ParseInLocation(grmi.DateTimeOutFormat, time.Now().Format(grmi.DateOutFormat) + " 00:00:00", utils.TimezoneLocation) |
|
|
|
today, _ := time.ParseInLocation(grmi.DateTimeOutFormat, time.Now().Format(grmi.DateOutFormat)+" 00:00:00", utils.TimezoneLocation) |
|
|
|
rowIndex := 0 |
|
|
|
projectMap := make(map[string]*meModel.Project) |
|
|
|
productFamilyMap := make(map[string]*meModel.ProductFamily) |
|
|
@ -3823,8 +3848,8 @@ func (impl *CustOrderServiceImplement) AnalysisPlanFromExcel(user *global.User, |
|
|
|
PlanQty: qty, |
|
|
|
WorkLineId: productFamily.WorkLineId, |
|
|
|
QuantityPerHour: int(productFamily.Jph), |
|
|
|
PlanStartDate: grmi.Date(planDate), |
|
|
|
PlanEndDate: grmi.Date(planDate), |
|
|
|
PlanStartDate: grmi.Date(planDate), |
|
|
|
PlanEndDate: grmi.Date(planDate), |
|
|
|
} |
|
|
|
planDateCustOrderMap[planDate.Format(grmi.DateOutFormat)] = append(planDateCustOrderMap[planDate.Format(grmi.DateOutFormat)], custOrder) |
|
|
|
} |
|
|
@ -3881,7 +3906,7 @@ func (impl *CustOrderServiceImplement) AnalysisPlanFromExcel(user *global.User, |
|
|
|
} |
|
|
|
for index, custOrder := range custOrderLi { |
|
|
|
custOrder.PlanStartTime = grmi.DateTime(prePlanEndTime) |
|
|
|
custOrder.PlanEndTime = grmi.DateTime(prePlanEndTime.Add(time.Duration(custOrder.PlanQty * perCarUsedTime) * time.Second)) |
|
|
|
custOrder.PlanEndTime = grmi.DateTime(prePlanEndTime.Add(time.Duration(custOrder.PlanQty*perCarUsedTime) * time.Second)) |
|
|
|
prePlanEndTime = custOrder.PlanEndTime.Restore() |
|
|
|
custOrderLi[index] = custOrder |
|
|
|
} |
|
|
@ -3919,11 +3944,11 @@ func (impl *CustOrderServiceImplement) AnalysisPlanFromExcel(user *global.User, |
|
|
|
custOrderStatusLi = append(custOrderStatusLi, custOrderStatus) |
|
|
|
custOrderQty := model.CustOrderQty{ |
|
|
|
CustOrderId: custOrderId, |
|
|
|
PlanQty: custOrder.PlanQty, |
|
|
|
PlanQty: custOrder.PlanQty, |
|
|
|
} |
|
|
|
custOrderQtyLi = append(custOrderQtyLi, custOrderQty) |
|
|
|
tempCustOrderLi = append(tempCustOrderLi, custOrder) |
|
|
|
if index != 0 && index % 20 == 0 { |
|
|
|
if index != 0 && index%20 == 0 { |
|
|
|
err = custOrderDao.Insert(&tempCustOrderLi) |
|
|
|
if err != nil { |
|
|
|
_ = session.Rollback() |
|
|
|