From 09d79784a86672352458f78a563fb84106e0b1a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=8F=E4=BA=8E=E6=98=8A?= <2074819354@qq.com> Date: Mon, 20 Jul 2020 21:46:24 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20co?= =?UTF-8?q?de/commodity1.txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/commodity1.txt | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 code/commodity1.txt diff --git a/code/commodity1.txt b/code/commodity1.txt deleted file mode 100644 index 8c3e0c2..0000000 --- a/code/commodity1.txt +++ /dev/null @@ -1,12 +0,0 @@ -001 apple 2020 7 14 wangyi qiang 100 5 6 2020 6 20 365 westroom -002 orange 2020 6 14 tengxun qiang 80 4 5 2020 6 10 35 westroom -003 banana 2020 7 5 sanxing qiang 100 9 10 2020 7 2 15 westroom -004 pear 2020 6 30 xiaomi qiang 90 5 6 2020 6 20 90 westroom -005 watermelon 2020 7 14 tengxun qiang 100 6 7 2020 6 15 90 eastroom -006 peach 2020 7 12 huawei qiang 100 3 5 2020 7 10 5 eastroom -007 pen 2020 7 14 zhongxing qiang 45 1 2 2020 5 11 365 eastroom -008 camera 2020 7 14 sanxing gift 10 500 650 2020 7 10 365 west-1A -009 computer 2020 6 10 huawei gift 30 3000 4000 2020 6 1 1000 west-1B -010 audio 2020 7 14 xiaomi buy 80 100 150 2020 7 5 180 east-1A -011 phone 2020 6 2 huawei buy 5 5000 6000 2020 6 1 700 east-1B -012 MP3 2020 7 14 zhongxing buy 100 50 70 2020 6 20 365 east-1C \ No newline at end of file -- Gitee From 10b0e000a5b06784937979d7c6d7022e22b35243 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=8F=E4=BA=8E=E6=98=8A?= <2074819354@qq.com> Date: Mon, 20 Jul 2020 21:46:30 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20co?= =?UTF-8?q?de/purchase.cpp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/purchase.cpp | 780 ---------------------------------------------- 1 file changed, 780 deletions(-) delete mode 100644 code/purchase.cpp diff --git a/code/purchase.cpp b/code/purchase.cpp deleted file mode 100644 index 33b84fd..0000000 --- a/code/purchase.cpp +++ /dev/null @@ -1,780 +0,0 @@ -#include -#include -#include -#include "purchase.h" - -suppliers suppliers_head; -suppliers suppliers_tail; -commodity commodity_head; -commodity commodity_tail; - -// 构造一个空的带头结点的进货双向链表 -Status InitList_purchase(purchase &head, purchase &tail) -{ - head = (purchase)malloc(sizeof(purchase_information)); - if(!head) - exit(OVERFLOW); - head->next = NULL; - tail = head; - return OK; -} - -// 在进货链表尾部添加一个进货结点 -Status ListAdd_purchase(purchase &tail, char number[], char name[], char source[], char channel[], int quantity, double price, date time) -{ - purchase p; - p = (purchase)malloc(sizeof(purchase_information)); - if(!p) - exit(OVERFLOW); - strcpy(p->number, number); - strcpy(p->name, name); - strcpy(p->source, source); - strcpy(p->channel, channel); - p->quantity = quantity; - p->price = price; - p->time.year = time.year; - p->time.month = time.month; - p->time.day = time.day; - p->pre = tail; - p->next = NULL; - tail->next = p; - tail = p; - return OK; -} - -// 在窗口中录出进货信息 -Status Printf_purchas(purchase &p) -{ - printf("%s %s %s %s %d %.2lf %d %d %d\n", - p->number, p->name, p->source, p->channel, p->quantity, p->price, p->time.year, p->time.month, p->time.day); - return OK; -} - -// 在文件中导出进货信息 -Status Fprintf_purchas(purchase &p) -{ - FILE *fp; - fp = fopen("suppliers2.txt", "a"); - if(fp == NULL) - { - printf("Can not open the file!"); - exit(INFEASIBLE); - } - fprintf(fp, "%s %s %s %s %d %lf %d %d %d\n", - p->number, p->name, p->source, p->channel, p->quantity, p->price, p->time.year, p->time.month, p->time.day); - fclose(fp); - return OK; -} - -// 遍历进货链表,依次对每个节点调用函数visit(),一旦visit()失败,则操作失败 -Status TraverseList_purchas(purchase &head, Status(*visit)(purchase &p)) -{ - purchase p; - p = head->next; - if(!p) - { - printf("暂无进货信息!\n"); - return OK; - } - while(p) - { - if(!visit(p)) - { - printf("进货信息遍历失败!\n"); - return ERROR; - } - p = p->next; - } - return OK; -} - -// 在窗口中录出进货链表 -Status DisplayList_purchas(purchase &head) -{ - TraverseList_purchas(head, Printf_purchas); - return OK; -} - -// 在文件中导出进货链表 -Status FdisplayList_purchas(purchase &head) -{ - TraverseList_purchas(head, Fprintf_purchas); - return OK; -} - -// 构造一个空的带头结点的供应商双向链表 -Status InitList_suppliers(suppliers &head, suppliers &tail) -{ - head = (suppliers)malloc(sizeof(suppliers_information)); - if(!head) - exit(OVERFLOW); - head->next = NULL; - tail = head; - InitList_purchase(head->purchase_head, head->purchase_tail); - return OK; -} - -// 查找供应商公司名称与关键字匹配的供应商结点 -Status ListHandle_suppliers(suppliers &head, suppliers &p, char corporate_name[]) -{ - p = head->next; - while(p) - { - if(strcmp(p->corporate_name, corporate_name) == 0) - { - break; - } - p = p->next; - } - return OK; -} - -// 在供应商链表尾部添加一个供应商结点 -Status ListAdd_suppliers(suppliers &tail, char corporate_name[], char main_business[], char main_products[], char brand[], char contact_person[], char telephone[]) -{ - suppliers p; - p = (suppliers)malloc(sizeof(suppliers_information)); - if(!p) - exit(OVERFLOW); - strcpy(p->corporate_name, corporate_name); - strcpy(p->main_business, main_business); - strcpy(p->main_products, main_products); - strcpy(p->brand, brand); - strcpy(p->contact_person, contact_person); - strcpy(p->telephone, telephone); - InitList_purchase(p->purchase_head, p->purchase_tail); - p->pre = tail; - p->next = NULL; - tail->next = p; - tail = p; - return OK; -} - -// 从窗口中录入供应商信息 -Status Add_suppliers(suppliers &head, suppliers &tail) -{ - suppliers p; - char corporate_name[MAX_SIZE]; - char main_business[MAX_SIZE]; - char main_products[MAX_SIZE]; - char brand[MAX_SIZE]; - char contact_person[MAX_SIZE]; - char telephone[MAX_SIZE]; - printf("请依次输入“公司名称、主营业务、主营产品、品牌、联络人、电话”,以空格作为结尾。\n"); - while(1) - { - scanf("%s %s %s %s %s %s", corporate_name, main_business, main_products, brand, contact_person, telephone); - ListHandle_suppliers(head, p, corporate_name); - if(p) - { - printf("公司名称为 %s 的供应商已存在,无需添加。\n", p->corporate_name); - if(getchar() == ' ') - { - break; - } - else - continue; - } - ListAdd_suppliers(tail, corporate_name, main_business, main_products, brand, contact_person, telephone); - if(getchar() == ' ') - { - break; - } - } - printf("供应商信息录入成功!\n"); - return OK; -} - -// 从文件中导入供应商信息 -Status Fadd_suppliers(suppliers &head, suppliers &tail) -{ - FILE *fp; - suppliers p; - char corporate_name[MAX_SIZE]; - char main_business[MAX_SIZE]; - char main_products[MAX_SIZE]; - char brand[MAX_SIZE]; - char contact_person[MAX_SIZE]; - char telephone[MAX_SIZE]; - fp = fopen("suppliers1.txt", "r"); - if(fp == NULL) - { - printf("Can not open the file!"); - exit(INFEASIBLE); - } - while(1) - { - fscanf(fp, "%s %s %s %s %s %s", corporate_name, main_business, main_products, brand, contact_person, telephone); - ListHandle_suppliers(head, p, corporate_name); - if(p) - { - printf("公司名称为 %s 的供应商已存在,无需添加!\n", p->corporate_name); - if(fgetc(fp) == ' ') - { - break; - } - else - continue; - } - ListAdd_suppliers(tail, corporate_name, main_business, main_products, brand, contact_person, telephone); - if(fgetc(fp) == ' ') - { - break; - } - } - fclose(fp); - printf("供应商信息导入成功!\n"); - return OK; -} - -// 删除供应商公司名称与关键字匹配的供应商结点 -Status ListDelete_suppliers(suppliers &head) -{ - suppliers p; - char corporate_name[MAX_SIZE]; - printf("请输入要删除供应商的公司名称:\n"); - scanf("%s", corporate_name); - ListHandle_suppliers(head, p, corporate_name); - if(!p) - { - printf("未找到公司名称为 %s 的供应商,无需删除!\n",corporate_name); - return ERROR; - } - if(p->next) - { - p->next->pre = p->pre; - } - p->pre->next = p->next; - free(p); - printf("供应商信息删除成功!\n"); - return OK; -} - -// 修改供应商公司名称与关键字匹配的供应商结点 -Status ListAlter_suppliers(suppliers &head, suppliers &tail) -{ - suppliers p; - char corporate_name[MAX_SIZE]; - char main_business[MAX_SIZE]; - char main_products[MAX_SIZE]; - char brand[MAX_SIZE]; - char contact_person[MAX_SIZE]; - char telephone[MAX_SIZE]; - char option; - bool flag = false; - printf("请输入要修改供应商的公司名称:\n"); - scanf("%s", corporate_name); - getchar(); - ListHandle_suppliers(head, p, corporate_name); - if(!p) - { - printf("未找到公司名称为 %s 的供应商,是否添加?(y/n)\n", corporate_name); - while(!flag) - { - scanf("%c", &option); - switch(option) - { - case 'y': - printf("请依次输入“主营业务、主营产品、品牌、联络人、电话”\n"); - scanf("%s %s %s %s %s", main_business, main_products, brand, contact_person, telephone); - ListAdd_suppliers(tail, corporate_name, main_business, main_products, brand, contact_person, telephone); - printf("供应商信息添加成功!\n"); - return OK; - case 'n': - flag = true; - break; - default: - printf("输入有误,请重新输入!\n"); - break; - } - } - return ERROR; - } - printf("请依次输入“公司名称、主营业务、主营产品、品牌、联络人、电话”\n"); - scanf("%s %s %s %s %s %s", corporate_name, main_business, main_products, brand, contact_person, telephone); - strcpy(p->corporate_name, corporate_name); - strcpy(p->main_business, main_business); - strcpy(p->main_products, main_products); - strcpy(p->brand, brand); - strcpy(p->contact_person, contact_person); - strcpy(p->telephone, telephone); - printf("供应商信息修改成功!\n"); - return OK; -} - -// 查询供应商公司名称与关键字匹配的供应商结点供应商信息 -Status ListSearch_suppliers(suppliers &head, suppliers &tail) -{ - suppliers p; - char corporate_name[MAX_SIZE]; - char main_business[MAX_SIZE]; - char main_products[MAX_SIZE]; - char brand[MAX_SIZE]; - char contact_person[MAX_SIZE]; - char telephone[MAX_SIZE]; - char option; - bool flag = false; - printf("请输入要查询供应商的公司名称:\n"); - scanf("%s", corporate_name); - getchar(); - ListHandle_suppliers(head, p, corporate_name); - if(!p) - { - printf("未找到公司名称为 %s 的供应商,是否添加?(y/n)\n", corporate_name); - while(!flag) - { - scanf("%c", &option); - switch(option) - { - case 'y': - printf("请依次输入“主营业务、主营产品、品牌、联络人、电话”\n"); - scanf("%s %s %s %s %s", main_business, main_products, brand, contact_person, telephone); - ListAdd_suppliers(tail, corporate_name, main_business, main_products, brand, contact_person, telephone); - printf("供应商信息添加成功!\n"); - return OK; - case 'n': - flag = true; - break; - default: - printf("输入有误,请重新输入!\n"); - break; - } - } - return ERROR; - } - Printf_suppliers(p); - return OK; -} - -// 在窗口中录出供应商信息 -Status Printf_suppliers(suppliers &p) -{ - printf("%s %s %s %s %s %s\n", p->corporate_name, p->main_business, p->main_products, p->brand, p->contact_person, p->telephone); - DisplayList_purchas(p->purchase_head); - return OK; -} - -// 在文件中导出供应商信息 -Status Fprintf_suppliers(suppliers &p) -{ - FILE *fp; - fp = fopen("suppliers2.txt", "a"); - if(fp == NULL) - { - printf("Can not open the file!"); - exit(INFEASIBLE); - } - fprintf(fp, "%s %s %s %s %s %s\n", p->corporate_name, p->main_business, p->main_products, p->brand, p->contact_person, p->telephone); - fclose(fp); - FdisplayList_purchas(p->purchase_head); - return OK; -} - -// 遍历供应商链表,依次对每个节点调用函数visit(),一旦visit()失败,则操作失败 -Status TraverseList_suppliers(suppliers &head, Status(*visit)(suppliers &p)) -{ - suppliers p; - p = head->next; - if(!p) - { - printf("暂无供应商信息!\n"); - return OK; - } - while(p) - { - if(!visit(p)) - { - printf("供应商信息遍历失败!\n"); - return ERROR; - } - p = p->next; - } - return OK; -} - -// 在窗口中录出供应商链表 -Status DisplayList_suppliers(suppliers &head) -{ - TraverseList_suppliers(head, Printf_suppliers); - printf("供应商信息录出成功!\n"); - return OK; -} - -// 在文件中导出供应商链表 -Status FdisplayList_suppliers(suppliers &head) -{ - TraverseList_suppliers(head, Fprintf_suppliers); - printf("供应商信息导出成功!\n"); - return OK; -} - -// 构造一个空的带头结点的商品向链表 -Status InitList_commodity(commodity &head, commodity &tail) -{ - head = (commodity)malloc(sizeof(goods)); - if(!head) - exit(OVERFLOW); - head->next = NULL; - tail = head; - return OK; -} - -// 在商品链表尾部添加一个商品结点 -Status ListAdd_commodity(commodity &tail, char id_Number[], char goods_Name[], char place[], - double buy_Price, double sell_Price, int remain_Number, int quality_Date, date purchase_Date, date produce_Date) -{ - commodity p; - p = (commodity)malloc(sizeof(goods)); - if(!p) - exit(OVERFLOW); - strcpy(p->id_Number, id_Number); - strcpy(p->goods_Name, goods_Name); - strcpy(p->place, place); - p->buy_Price = buy_Price; - p->sell_Price = sell_Price; - p->remain_Number = remain_Number; - p->quality_Date = quality_Date; - p->purchase_Date.year = purchase_Date.year; - p->purchase_Date.month = purchase_Date.month; - p->purchase_Date.day = purchase_Date.day; - p->produce_Date.year = produce_Date.year; - p->produce_Date.month = produce_Date.month; - p->produce_Date.day = produce_Date.day; - p->pre = tail; - p->next = NULL; - tail->next = p; - tail = p; - return OK; -} - -// 查找商品编号与关键字匹配的供应商结点 -Status ListHandle_commodity(commodity &head, commodity &p, char id_Number[]) -{ - p = head->next; - while(p) - { - if(strcmp(p->id_Number, id_Number) == 0) - { - break; - } - p = p->next; - } - return OK; -} - -// 从窗口中录入商品信息 -Status Add_commodity(commodity &head, commodity &tail, suppliers &suppliers_head, suppliers &suppliers_tail) -{ - commodity p; - suppliers suppliers_p; - char id_Number[20]; - char goods_Name[20]; - char place[20]; - char source[MAX_SIZE]; - char channel[MAX_SIZE]; - char main_business[MAX_SIZE]; - char main_products[MAX_SIZE]; - char brand[MAX_SIZE]; - char contact_person[MAX_SIZE]; - char telephone[MAX_SIZE]; - double buy_Price; - double sell_Price; - int quantity; - int quality_Date; - date purchase_Date; - date produce_Date; - bool flag = false; - printf("请依次输入“商品编号、商品名称、进货日期、进货来源(供应商)、进货渠道、进货数量、商品进价、商品售价、生产日期、保质期、库存位置”,以空格作为结尾。\n"); - while(1) - { - scanf("%s %s %d %d %d %s %s %d %lf %lf %d %d %d %d %s", - id_Number, goods_Name, &purchase_Date.year, &purchase_Date.month, &purchase_Date.day, source, channel, &quantity, - &buy_Price, &sell_Price, &produce_Date.year, &produce_Date.month, &produce_Date.day, &quality_Date, place); - if(getchar() == ' ') - { - flag = true; - } - ListHandle_commodity(head, p, id_Number); - if(p) - { - if(strcmp(p->goods_Name, goods_Name) != 0 || strcmp(p->place, place) != 0 - || p->buy_Price != buy_Price || p->sell_Price != sell_Price || p->quality_Date != quality_Date - || p->purchase_Date.year != purchase_Date.year || p->purchase_Date.month != purchase_Date.month || p->purchase_Date.day != purchase_Date.day - || p->produce_Date.year != produce_Date.year || p->produce_Date.month != produce_Date.month || p->produce_Date.day != produce_Date.day) - { - printf("编号 %s 已存在商品信息\n", id_Number); - return ERROR; - } - p->remain_Number += quantity; - } - else - ListAdd_commodity(tail, id_Number, goods_Name, place, buy_Price, sell_Price, quantity, quality_Date, purchase_Date, produce_Date); - ListHandle_suppliers(suppliers_head, suppliers_p, source); - if(!suppliers_p) - { - printf("未找到公司名称为 %s 的供应商,请先添加!\n", source); - printf("请依次输入“主营业务、主营产品、品牌、联络人、电话”\n"); - scanf("%s %s %s %s %s", main_business, main_products, brand, contact_person, telephone); - ListAdd_suppliers(suppliers_tail, source, main_business, main_products, brand, contact_person, telephone); - printf("供应商信息添加成功!\n"); - ListHandle_suppliers(suppliers_head, suppliers_p, source); - } - ListAdd_purchase(suppliers_p->purchase_tail, id_Number, goods_Name, source, channel, quantity, buy_Price, purchase_Date); - if(flag == true) - { - break; - } - } - printf("商品信息录入成功!\n"); - printf("进货信息录入成功!\n"); - return OK; -} - -// 从文件中导入商品信息 -Status Fadd_commodity(commodity &head, commodity &tail, suppliers &suppliers_head, suppliers &suppliers_tail) -{ - FILE *fp; - commodity p; - suppliers suppliers_p; - char id_Number[20]; - char goods_Name[20]; - char place[20]; - char source[MAX_SIZE]; - char channel[MAX_SIZE]; - char main_business[MAX_SIZE]; - char main_products[MAX_SIZE]; - char brand[MAX_SIZE]; - char contact_person[MAX_SIZE]; - char telephone[MAX_SIZE]; - double buy_Price; - double sell_Price; - int quantity; - int quality_Date; - date purchase_Date; - date produce_Date; - bool flag = false; - fp = fopen("commodity1.txt", "r"); - if(fp == NULL) - { - printf("Can not open the file!"); - exit(INFEASIBLE); - } - while(1) - { - fscanf(fp, "%s %s %d %d %d %s %s %d %lf %lf %d %d %d %d %s", - id_Number, goods_Name, &purchase_Date.year, &purchase_Date.month, &purchase_Date.day, source, channel, &quantity, - &buy_Price, &sell_Price, &produce_Date.year, &produce_Date.month, &produce_Date.day, &quality_Date, place); - if(fgetc(fp) == ' ') - { - flag = true; - } - ListHandle_commodity(head, p, id_Number); - if(p) - { - if(strcmp(p->goods_Name, goods_Name) != 0 || strcmp(p->place, place) != 0 - || p->buy_Price != buy_Price || p->sell_Price != sell_Price || p->quality_Date != quality_Date - || p->purchase_Date.year != purchase_Date.year || p->purchase_Date.month != purchase_Date.month || p->purchase_Date.day != purchase_Date.day - || p->produce_Date.year != produce_Date.year || p->produce_Date.month != produce_Date.month || p->produce_Date.day != produce_Date.day) - { - printf("编号 %s 已存在商品信息\n", id_Number); - return ERROR; - } - p->remain_Number += quantity; - } - else - ListAdd_commodity(tail, id_Number, goods_Name, place, buy_Price, sell_Price, quantity, quality_Date, purchase_Date, produce_Date); - ListHandle_suppliers(suppliers_head, suppliers_p, source); - if(!suppliers_p) - { - printf("未找到公司名称为 %s 的供应商,请先添加!\n", source); - printf("请依次输入“主营业务、主营产品、品牌、联络人、电话”\n"); - scanf("%s %s %s %s %s", main_business, main_products, brand, contact_person, telephone); - ListAdd_suppliers(suppliers_tail, source, main_business, main_products, brand, contact_person, telephone); - printf("供应商信息添加成功!\n"); - ListHandle_suppliers(suppliers_head, suppliers_p, source); - } - ListAdd_purchase(suppliers_p->purchase_tail, id_Number, goods_Name, source, channel, quantity, buy_Price, purchase_Date); - if(flag == true) - { - break; - } - } - fclose(fp); - printf("商品信息导入成功!\n"); - printf("进货信息导入成功!\n"); - return OK; -} - -// 添加供应商信息界面 -Status Interface_add_suppliers(commodity &commodity_head, commodity &commodity_tail, - suppliers &suppliers_head, suppliers &suppliers_tail) -{ - int option; - bool flag = false; - system("cls"); - printf("添加供应商信息界面\n1.从窗口中录入供应商信息\n2.从文件中导入供应商信息\n3.返回上一级界面\n4.返回主界面\n"); - while(!flag) - { - scanf("%d", &option); - switch(option) - { - case 1: - Add_suppliers(suppliers_head, suppliers_tail); - break; - case 2: - Fadd_suppliers(suppliers_head, suppliers_tail); - break; - case 3: - Interface_suppliers_management(commodity_head, commodity_tail, suppliers_head, suppliers_tail); - flag = true; - break; - case 4: - Main_interface(commodity_head, commodity_tail, suppliers_head, suppliers_tail); - flag = true; - break; - default: - printf("输入有误,请重新输入!\n"); - break; - } - } - return OK; -} - -// 打印供应商信息界面 -Status Interface_print_suppliers(commodity &commodity_head, commodity &commodity_tail, - suppliers &suppliers_head, suppliers &suppliers_tail) -{ - int option; - bool flag = false; - system("cls"); - printf("打印供应商信息界面\n1.从窗口中录出供应商信息\n2.从文件中导出供应商信息\n3.返回上一级界面\n4.返回主界面\n"); - while(!flag) - { - scanf("%d", &option); - switch(option) - { - case 1: - DisplayList_suppliers(suppliers_head); - break; - case 2: - FdisplayList_suppliers(suppliers_head); - break; - case 3: - Interface_suppliers_management(commodity_head, commodity_tail, suppliers_head, suppliers_tail); - flag = true; - break; - case 4: - Main_interface(commodity_head, commodity_tail, suppliers_head, suppliers_tail); - flag = true; - break; - default: - printf("输入有误,请重新输入!\n"); - break; - } - } - return OK; -} - -// 供应商信息管理界面 -Status Interface_suppliers_management(commodity &commodity_head, commodity &commodity_tail, - suppliers &suppliers_head, suppliers &suppliers_tail) -{ - int option; - bool flag = false; - system("cls"); - printf("供应商信息管理界面\n1.添加供应商信息\n2.删除供应商信息\n3.修改供应商信息\n4.查询供应商信息\n5.打印供应商信息\n6.返回主界面\n"); - while(!flag) - { - scanf("%d", &option); - switch(option) - { - case 1: - Interface_add_suppliers(commodity_head, commodity_tail, suppliers_head, suppliers_tail); - flag = true; - break; - case 2: - ListDelete_suppliers(suppliers_head); - break; - case 3: - ListAlter_suppliers(suppliers_head, suppliers_tail); - break; - case 4: - ListSearch_suppliers(suppliers_head, suppliers_tail); - break; - case 5: - Interface_print_suppliers(commodity_head, commodity_tail, suppliers_head, suppliers_tail); - flag = true; - break; - case 6: - Main_interface(commodity_head, commodity_tail, suppliers_head, suppliers_tail); - flag = true; - break; - default: - printf("输入有误,请重新输入!\n"); - break; - } - } - return OK; -} - -// 进货管理界面 -Status Interface_purchase_management(commodity &commodity_head, commodity &commodity_tail, - suppliers &suppliers_head, suppliers &suppliers_tail) -{ - int option; - bool flag = false; - system("cls"); - printf("进货管理界面\n1.从窗口中录入商品信息和进货信息\n2.从文件中导入商品信息和进货信息\n3.返回主界面\n"); - while(!flag) - { - scanf("%d", &option); - switch(option) - { - case 1: - Add_commodity(commodity_head, commodity_tail, suppliers_head, suppliers_tail); - break; - case 2: - Fadd_commodity(commodity_head, commodity_tail, suppliers_head, suppliers_tail); - break; - case 3: - Main_interface(commodity_head, commodity_tail, suppliers_head, suppliers_tail); - flag = true; - break; - default: - printf("输入有误,请重新输入!\n"); - break; - } - } - return OK; -} - -// 主界面 -Status Main_interface(commodity &commodity_head, commodity &commodity_tail, - suppliers &suppliers_head, suppliers &suppliers_tail) -{ - int option; - bool flag = false; - system("cls"); - printf("主界面\n1.供应商信息管理\n2.进货管理\n3.退出主界面\n"); - while(!flag) - { - scanf("%d", &option); - switch(option) - { - case 1: - Interface_suppliers_management(commodity_head, commodity_tail, suppliers_head, suppliers_tail); - flag = true; - break; - case 2: - Interface_purchase_management(commodity_head, commodity_tail, suppliers_head, suppliers_tail); - flag = true; - break; - case 3: - return OK; - default: - printf("输入有误,请重新输入!\n"); - break; - } - } - return OK; -} -- Gitee From c381d5a555034c3382acaa39f350d8979d3eb211 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=8F=E4=BA=8E=E6=98=8A?= <2074819354@qq.com> Date: Mon, 20 Jul 2020 21:46:35 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20co?= =?UTF-8?q?de/purchase.h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/purchase.h | 159 ------------------------------------------------ 1 file changed, 159 deletions(-) delete mode 100644 code/purchase.h diff --git a/code/purchase.h b/code/purchase.h deleted file mode 100644 index 9dd0e32..0000000 --- a/code/purchase.h +++ /dev/null @@ -1,159 +0,0 @@ -#ifndef __PURCHASE_H__ -#define __PURCHASE_H__ - -// ׼ͷļṹ - -// -#define MAX_SIZE 30 - -// ״̬ -#define TRUE 1 // -#define FALSE 0 // -#define OK 1 // -#define ERROR 0 // -#define INFEASIBLE -1 // -#define OVERFLOW -2 // - -// Status ǺֵͣǺ״̬ -typedef int Status; - -// ʱṹ壬洢ꡢ¡Ϣ -#include "date.h" - -// Ʒ棩ṹ -#include "sell.h" - -/* ˫ĵڵ㣬ӦĽṹԱͬʱ޸Ĺ캯purchase.cppУ */ - -// ϢԳеIJɹй洢Щʱ䡢Դ/۸Ϣ -typedef struct purchase_information -{ - char number[MAX_SIZE]; // Ʒ - char name[MAX_SIZE]; // Ʒ - char source[MAX_SIZE]; // Դ - char channel[MAX_SIZE]; // - int quantity; // - double price; // ۸ - date time; // ʱ - purchase_information *pre; // һָ - purchase_information *next; // һָ -}*purchase; - -// ӦϢ洢˾ơӪҵ/ƷƷơˡ绰Ϣ -struct suppliers_information -{ - char corporate_name[MAX_SIZE]; // ˾ - char main_business[MAX_SIZE]; // Ӫҵ - char main_products[MAX_SIZE]; // ӪƷ - char brand[MAX_SIZE]; // Ʒ - char contact_person[MAX_SIZE]; // - char telephone[MAX_SIZE]; // 绰 - purchase purchase_head; // Ϣͷڵ - purchase purchase_tail; // Ϣβ - suppliers_information *pre; // һӦָ - suppliers_information *next; // һӦָ -}; -typedef struct suppliers_information *suppliers; - -extern suppliers suppliers_head; -extern suppliers suppliers_tail; -extern commodity commodity_head; -extern commodity commodity_tail; - -// һյĴͷĽ˫ -Status InitList_purchase(purchase &head, purchase &tail); - -// ڽβһ -Status ListAdd_purchase(purchase &tail, char number[], char name[], char source[], char channel[], int quantity, double price, date time); - -// ڴ¼Ϣ -Status Printf_purchas(purchase &p); - -// ļеϢ -Status Fprintf_purchas(purchase &p); - -// ζÿڵúvisit()һvisit()ʧܣʧ -Status TraverseList_purchas(purchase &head, Status(*visit)(purchase &p)); - -// ڴ¼ -Status DisplayList_purchas(purchase &head); - -// ļе -Status FdisplayList_purchas(purchase &head); - -// һյĴͷĹӦ˫ -Status InitList_suppliers(suppliers &head, suppliers &tail); - -// ҹӦ̹˾ؼƥĹӦ̽ -Status ListHandle_suppliers(suppliers &head, suppliers &p, char corporate_name[]); - -// ڹӦβһӦ̽ -Status ListAdd_suppliers(suppliers &tail, char corporate_name[], char main_business[], char main_products[], char brand[], char contact_person[], char telephone[]); - -// Ӵ¼빩ӦϢ -Status Add_suppliers(suppliers &head, suppliers &tail); - -// ļе빩ӦϢ -Status Fadd_suppliers(suppliers &head, suppliers &tail); - -// ɾӦ̹˾ؼƥĹӦ̽ -Status ListDelete_suppliers(suppliers &head); - -// ޸ĹӦ̹˾ؼƥĹӦ̽ -Status ListAlter_suppliers(suppliers &head, suppliers &tail); - -// ѯӦ̹˾ؼƥĹӦ̽㹩ӦϢ -Status ListSearch_suppliers(suppliers &head, suppliers &tail); - -// ڴӦϢ -Status Printf_suppliers(suppliers &p); - -// ļеӦϢ -Status Fprintf_suppliers(suppliers &p); - -// Ӧζÿڵúvisit()һvisit()ʧܣʧ -Status TraverseList_suppliers(suppliers &head, Status(*visit)(suppliers &p)); - -// ڴ¼Ӧ -Status DisplayList_suppliers(suppliers &head); - -// ļеӦ -Status FdisplayList_suppliers(suppliers &head); - -// һյĴͷƷ -Status InitList_commodity(commodity &head, commodity &tail); - -// ƷβһƷ -Status ListAdd_commodity(commodity &tail, char id_Number[], char goods_Name[], char place[], - double buy_Prise, double sell_Prise, int remain_Number, int quality_Date, date purchase_Date, date produce_Date); - -// ƷؼƥĹӦ̽ -Status ListHandle_commodity(commodity &head, commodity &p, char id_Number[]); - -// Ӵ¼ƷϢ -Status Add_commodity(commodity &head, commodity &tail, suppliers &suppliers_head, suppliers &suppliers_tail); - -// ļеƷϢ -Status Fadd_commodity(commodity &head, commodity &tail, suppliers &suppliers_head, suppliers &suppliers_tail); - -// ӹӦϢ -Status Interface_add_suppliers(commodity &commodity_head, commodity &commodity_tail, - suppliers &suppliers_head, suppliers &suppliers_tail); - -// ӡӦϢ -Status Interface_print_suppliers(commodity &commodity_head, commodity &commodity_tail, - suppliers &suppliers_head, suppliers &suppliers_tail); - -// ӦϢ -Status Interface_suppliers_management(commodity &commodity_head, commodity &commodity_tail, - suppliers &suppliers_head, suppliers &suppliers_tail); - -// -Status Interface_purchase_management(commodity &commodity_head, commodity &commodity_tail, - suppliers &suppliers_head, suppliers &suppliers_tail); - -// -Status Main_interface(commodity &commodity_head, commodity &commodity_tail, - suppliers &suppliers_head, suppliers &suppliers_tail); - -#endif \ No newline at end of file -- Gitee From bd0a54099af4b3e7b70832362fa6a158cd1eca12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=8F=E4=BA=8E=E6=98=8A?= <2074819354@qq.com> Date: Mon, 20 Jul 2020 21:46:41 +0800 Subject: [PATCH 04/10] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20co?= =?UTF-8?q?de/suppliers1.txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/suppliers1.txt | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 code/suppliers1.txt diff --git a/code/suppliers1.txt b/code/suppliers1.txt deleted file mode 100644 index 7e80b65..0000000 --- a/code/suppliers1.txt +++ /dev/null @@ -1,6 +0,0 @@ -tengxun tengxun1 tengxun2 tengxun3 tengxun4 1111 -wangyi wangyi1 wangyi2 wangyi3 wangyi4 2222 -xiaomi xiaomi1 xiaomi2 xiaomi3 xiaomi4 3333 -huawei huawei1 huawei2 huawei3 huawei4 4444 -zhongxing zhongxing1 zhongxing2 zhongxing3 zhongxing4 5555 -sanxing sanxing1 sanxing2 sanxing3 sanxing4 6666 \ No newline at end of file -- Gitee From 185e900586c49687927f9ba25ce806a797100752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=8F=E4=BA=8E=E6=98=8A?= <2074819354@qq.com> Date: Mon, 20 Jul 2020 21:52:31 +0800 Subject: [PATCH 05/10] =?UTF-8?q?=E4=BE=9B=E5=BA=94=E5=95=86=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E7=AE=A1=E7=90=86=E5=92=8C=E8=BF=9B=E8=B4=A7=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E2=80=94=E2=80=94=E6=9C=80=E7=BB=88=E7=89=88=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E4=BE=9B=E5=BA=94=E5=95=86=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E4=BF=9D=E5=AD=98=E7=9A=84=E5=8A=9F=E8=83=BD=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=BA=86=E5=9C=A8=E6=96=87=E4=BB=B6=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E5=AF=BC=E5=87=BA=E9=94=99=E8=AF=AF=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=BA=86=E9=80=80=E5=87=BA=E4=B8=BB=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E7=9A=84=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/Project1.cpp | 10 + code/commodity1.txt | 7 + code/commodity2.txt | 1 + code/purchase.cpp | 867 ++++++++++++++++++++++++++++++++++++++++++++ code/purchase.h | 182 ++++++++++ code/suppliers1.txt | 6 + code/suppliers2.txt | 0 7 files changed, 1073 insertions(+) create mode 100644 code/Project1.cpp create mode 100644 code/commodity1.txt create mode 100644 code/commodity2.txt create mode 100644 code/purchase.cpp create mode 100644 code/purchase.h create mode 100644 code/suppliers1.txt create mode 100644 code/suppliers2.txt diff --git a/code/Project1.cpp b/code/Project1.cpp new file mode 100644 index 0000000..9034f27 --- /dev/null +++ b/code/Project1.cpp @@ -0,0 +1,10 @@ +#include "purchase.h" +Status main() +{ + suppliers suppliers_head, suppliers_tail; + commodity commodity_head, commodity_tail; + InitList_suppliers(suppliers_head, suppliers_tail); + InitList_commodity(commodity_head, commodity_tail); + Main_interface(commodity_head, commodity_tail, suppliers_head, suppliers_tail); + return OK; +} diff --git a/code/commodity1.txt b/code/commodity1.txt new file mode 100644 index 0000000..67ca69a --- /dev/null +++ b/code/commodity1.txt @@ -0,0 +1,7 @@ +001 apple 2020 7 14 wangyi qiang 100 5 6 2020 5 20 365 westroom +002 orange 2020 7 14 tengxun qiang 100 4 5 2020 6 10 90 westroom +003 banana 2020 7 14 sanxing qiang 100 9 10 2020 6 10 90 westroom +004 pear 2020 7 14 xiaomi qiang 100 5 6 2020 6 20 90 westroom +005 watermelon 2020 7 14 tengxun qiang 100 6 7 2020 6 15 90 eastroom +006 peach 2020 7 14 huawei qiang 100 3 4 2020 6 20 90 eastroom +007 pen 2020 7 14 zhongxing qiang 100 1 2 2020 5 11 365 eastroom \ No newline at end of file diff --git a/code/commodity2.txt b/code/commodity2.txt new file mode 100644 index 0000000..d3f5a12 --- /dev/null +++ b/code/commodity2.txt @@ -0,0 +1 @@ + diff --git a/code/purchase.cpp b/code/purchase.cpp new file mode 100644 index 0000000..451a764 --- /dev/null +++ b/code/purchase.cpp @@ -0,0 +1,867 @@ +#include +#include +#include +#include "purchase.h" + +// һյĴͷĽ˫ +Status InitList_purchase(purchase& head, purchase& tail) +{ + head = (purchase)malloc(sizeof(purchase_information)); + if (!head) + exit(OVERFLOW); + head->next = NULL; + tail = head; + return OK; +} + +// ڽβһ +Status ListAdd_purchase(purchase& tail, char number[], char name[], char source[], char channel[], int quantity, double price, date time) +{ + purchase p; + p = (purchase)malloc(sizeof(purchase_information)); + if (!p) + exit(OVERFLOW); + strcpy(p->number, number); + strcpy(p->name, name); + strcpy(p->source, source); + strcpy(p->channel, channel); + p->quantity = quantity; + p->price = price; + p->time.year = time.year; + p->time.month = time.month; + p->time.day = time.day; + p->pre = tail; + p->next = NULL; + tail->next = p; + tail = p; + return OK; +} + +// ڴ¼Ϣ +Status Printf_purchas(purchase& p) +{ + printf("%s %s %s %s %d %.2lf %d %d %d\n", + p->number, p->name, p->source, p->channel, p->quantity, p->price, p->time.year, p->time.month, p->time.day); + return OK; +} + +// ļеϢ +Status Fprintf_purchas(FILE* fp, purchase& p) +{ + fprintf(fp, "%s %s %s %s %d %.2lf %d %d %d\n", + p->number, p->name, p->source, p->channel, p->quantity, p->price, p->time.year, p->time.month, p->time.day); + return OK; +} + +// ڴбζÿڵúvisit()һvisit()ʧܣʧ +Status TraverseList_purchas(purchase& head, Status(*visit)(purchase& p)) +{ + purchase p; + p = head->next; + if (!p) + { + printf("޽Ϣ\n"); + return OK; + } + while (p) + { + if (!visit(p)) + { + printf("Ϣʧܣ\n"); + return ERROR; + } + p = p->next; + } + return OK; +} + +// ļбζÿڵúvisit()һvisit()ʧܣʧ +Status FtraverseList_purchas(FILE* fp, purchase& head, Status(*visit)(FILE* fp, purchase& p)) +{ + purchase p; + p = head->next; + if (!p) + { + fprintf(fp, "޽Ϣ\n"); + return OK; + } + while (p) + { + if (!visit(fp, p)) + { + printf("Ϣʧܣ\n"); + return ERROR; + } + p = p->next; + } + return OK; +} + +// ڴ¼ +Status DisplayList_purchas(purchase& head) +{ + TraverseList_purchas(head, Printf_purchas); + return OK; +} + +// ļе +Status FdisplayList_purchas(FILE* fp, purchase& head) +{ + FtraverseList_purchas(fp, head, Fprintf_purchas); + return OK; +} + +// һյĴͷĹӦ˫ +Status InitList_suppliers(suppliers& head, suppliers& tail) +{ + head = (suppliers)malloc(sizeof(suppliers_information)); + if (!head) + exit(OVERFLOW); + head->next = NULL; + tail = head; + InitList_purchase(head->purchase_head, head->purchase_tail); + return OK; +} + +// ҹӦ̹˾ؼƥĹӦ̽ +Status ListHandle_suppliers(suppliers& head, suppliers& p, char corporate_name[]) +{ + p = head->next; + while (p) + { + if (strcmp(p->corporate_name, corporate_name) == 0) + { + break; + } + p = p->next; + } + return OK; +} + +// ڹӦβһӦ̽ +Status ListAdd_suppliers(suppliers& tail, char corporate_name[], char main_business[], char main_products[], char brand[], char contact_person[], char telephone[]) +{ + suppliers p; + p = (suppliers)malloc(sizeof(suppliers_information)); + if (!p) + exit(OVERFLOW); + strcpy(p->corporate_name, corporate_name); + strcpy(p->main_business, main_business); + strcpy(p->main_products, main_products); + strcpy(p->brand, brand); + strcpy(p->contact_person, contact_person); + strcpy(p->telephone, telephone); + InitList_purchase(p->purchase_head, p->purchase_tail); + p->pre = tail; + p->next = NULL; + tail->next = p; + tail = p; + return OK; +} + +// Ӵ¼빩ӦϢ +Status Add_suppliers(suppliers& head, suppliers& tail) +{ + suppliers p; + char corporate_name[MAX_SIZE]; + char main_business[MAX_SIZE]; + char main_products[MAX_SIZE]; + char brand[MAX_SIZE]; + char contact_person[MAX_SIZE]; + char telephone[MAX_SIZE]; + printf("롰˾ơӪҵӪƷƷơˡ绰ԿոΪβ\n"); + while (1) + { + scanf("%s %s %s %s %s %s", corporate_name, main_business, main_products, brand, contact_person, telephone); + ListHandle_suppliers(head, p, corporate_name); + if (p) + { + printf("˾Ϊ%sĹӦѴڣӡ\n", corporate_name); + if (getchar() == ' ') + { + break; + } + else + continue; + } + ListAdd_suppliers(tail, corporate_name, main_business, main_products, brand, contact_person, telephone); + if (getchar() == ' ') + { + break; + } + } + printf("ӦϢ¼ɹ\n"); + return OK; +} + +// ļе빩ӦϢ +Status Fadd_suppliers(suppliers& head, suppliers& tail) +{ + FILE* fp; + suppliers p; + char corporate_name[MAX_SIZE]; + char main_business[MAX_SIZE]; + char main_products[MAX_SIZE]; + char brand[MAX_SIZE]; + char contact_person[MAX_SIZE]; + char telephone[MAX_SIZE]; + fp = fopen("suppliers1.txt", "r"); + if (fp == NULL) + { + printf("Can not open the file!"); + exit(INFEASIBLE); + } + while (1) + { + fscanf(fp, "%s %s %s %s %s %s", corporate_name, main_business, main_products, brand, contact_person, telephone); + ListHandle_suppliers(head, p, corporate_name); + if (p) + { + printf("˾Ϊ%sĹӦѴڣ!\n", corporate_name); + if (fgetc(fp) == ' ') + { + break; + } + else + continue; + } + ListAdd_suppliers(tail, corporate_name, main_business, main_products, brand, contact_person, telephone); + if (fgetc(fp) == ' ') + { + break; + } + } + fclose(fp); + printf("ӦϢɹ\n"); + return OK; +} + +// ɾӦ̹˾ؼƥĹӦ̽ +Status ListDelete_suppliers(suppliers& head) +{ + suppliers p; + char corporate_name[MAX_SIZE]; + printf("ҪɾӦ̵Ĺ˾ƣ\n"); + scanf("%s", corporate_name); + ListHandle_suppliers(head, p, corporate_name); + if (!p) + { + printf("δҵ˾Ϊ%sĹӦ,ɾ\n", corporate_name); + return ERROR; + } + if (p->next) + { + p->next->pre = p->pre; + } + p->pre->next = p->next; + free(p); + printf("ӦϢɾɹ\n"); + return OK; +} + +// ޸ĹӦ̹˾ؼƥĹӦ̽ +Status ListAlter_suppliers(suppliers& head, suppliers& tail) +{ + suppliers p; + char corporate_name[MAX_SIZE]; + char main_business[MAX_SIZE]; + char main_products[MAX_SIZE]; + char brand[MAX_SIZE]; + char contact_person[MAX_SIZE]; + char telephone[MAX_SIZE]; + char option; + bool flag = false; + printf("Ҫ޸ĹӦ̵Ĺ˾ƣ\n"); + scanf("%s", corporate_name); + getchar(); + ListHandle_suppliers(head, p, corporate_name); + if (!p) + { + printf("δҵ˾Ϊ%sĹӦ̣Ƿӣy/n\n", corporate_name); + while (!flag) + { + scanf("%c", &option); + switch (option) + { + case 'y': + printf("롰ӪҵӪƷƷơˡ绰\n"); + scanf("%s %s %s %s %s", main_business, main_products, brand, contact_person, telephone); + ListAdd_suppliers(tail, corporate_name, main_business, main_products, brand, contact_person, telephone); + printf("ӦϢӳɹ\n"); + return OK; + case 'n': + printf("ӦϢʧܣ\n"); + flag = true; + break; + default: + printf("룡\n"); + break; + } + } + return ERROR; + } + printf("롰˾ơӪҵӪƷƷơˡ绰\n"); + scanf("%s %s %s %s %s %s", corporate_name, main_business, main_products, brand, contact_person, telephone); + strcpy(p->corporate_name, corporate_name); + strcpy(p->main_business, main_business); + strcpy(p->main_products, main_products); + strcpy(p->brand, brand); + strcpy(p->contact_person, contact_person); + strcpy(p->telephone, telephone); + printf("ӦϢ޸ijɹ\n"); + return OK; +} + +// ѯӦ̹˾ؼƥĹӦ̽㹩ӦϢ +Status ListSearch_suppliers(suppliers& head, suppliers& tail) +{ + suppliers p; + char corporate_name[MAX_SIZE]; + char main_business[MAX_SIZE]; + char main_products[MAX_SIZE]; + char brand[MAX_SIZE]; + char contact_person[MAX_SIZE]; + char telephone[MAX_SIZE]; + char option; + bool flag = false; + printf("ҪѯӦ̵Ĺ˾ƣ\n"); + scanf("%s", corporate_name); + getchar(); + ListHandle_suppliers(head, p, corporate_name); + if (!p) + { + printf("δҵ˾Ϊ%sĹӦ̣Ƿӣy/n\n", corporate_name); + while (!flag) + { + scanf("%c", &option); + switch (option) + { + case 'y': + printf("롰ӪҵӪƷƷơˡ绰\n"); + scanf("%s %s %s %s %s", main_business, main_products, brand, contact_person, telephone); + ListAdd_suppliers(tail, corporate_name, main_business, main_products, brand, contact_person, telephone); + printf("ӦϢӳɹ\n"); + return OK; + case 'n': + printf("ӦϢʧܣ\n"); + flag = true; + break; + default: + printf("룡\n"); + break; + } + } + return ERROR; + } + Printf_suppliers(p); + return OK; +} + +// ڴ¼ӦϢ +Status Printf_suppliers(suppliers& p) +{ + printf("%s %s %s %s %s %s\n", p->corporate_name, p->main_business, p->main_products, p->brand, p->contact_person, p->telephone); + DisplayList_purchas(p->purchase_head); + return OK; +} + +// ļеӦϢ +Status Fprintf_suppliers(FILE* fp, suppliers& p) +{ + fprintf(fp, "%s %s %s %s %s %s\n", p->corporate_name, p->main_business, p->main_products, p->brand, p->contact_person, p->telephone); + FdisplayList_purchas(fp, p->purchase_head); + return OK; +} + +// ڴбӦζÿڵúvisit()һvisit()ʧܣʧ +Status TraverseList_suppliers(suppliers& head, Status(*visit)(suppliers& p)) +{ + suppliers p; + p = head->next; + if (!p) + { + printf("޹ӦϢ\n"); + return OK; + } + while (p) + { + if (!visit(p)) + { + printf("ӦϢʧܣ\n"); + return ERROR; + } + p = p->next; + } + return OK; +} + +// ļбӦζÿڵúvisit()һvisit()ʧܣʧ +Status FtraverseList_suppliers1(suppliers& head, Status(*visit)(FILE* fp, suppliers& p)) +{ + FILE* fp; + suppliers p; + fp = fopen("suppliers2.txt", "a"); + if (fp == NULL) + { + printf("Can not open the file!"); + exit(INFEASIBLE); + } + p = head->next; + if (!p) + { + fprintf(fp, "޹ӦϢ\n"); + return OK; + } + while (p) + { + if (!visit(fp, p)) + { + printf("ӦϢʧܣ\n"); + return ERROR; + } + p = p->next; + } + fclose(fp); + return OK; +} + +// ڴ¼Ӧ +Status DisplayList_suppliers(suppliers& head) +{ + TraverseList_suppliers(head, Printf_suppliers); + printf("ӦϢ¼ɹ\n"); + return OK; +} + +// ļеӦ +Status FdisplayList_suppliers(suppliers& head) +{ + FtraverseList_suppliers1(head, Fprintf_suppliers); + printf("ӦϢɹ\n"); + return OK; +} + +// 湩ӦϢ +Status Save_suppliers(FILE* fp, suppliers& p) +{ + fprintf(fp, "%s %s %s %s %s %s", p->corporate_name, p->main_business, p->main_products, p->brand, p->contact_person, p->telephone); + if (p->next) + { + fprintf(fp, "\n"); + } + else + { + fprintf(fp, " "); + } + return OK; +} + +// ļӦζÿڵúvisit()һvisit()ʧܣʧ +Status FtraverseList_suppliers2(suppliers& head, Status(*visit)(FILE* fp, suppliers& p)) +{ + FILE* fp; + suppliers p; + fp = fopen("suppliers1.txt", "w"); + if (fp == NULL) + { + printf("Can not open the file!"); + exit(INFEASIBLE); + } + p = head->next; + if (!p) + { + fprintf(fp, "޹ӦϢ\n"); + return OK; + } + while (p) + { + if (!visit(fp, p)) + { + printf("ӦϢʧܣ\n"); + return ERROR; + } + p = p->next; + } + fclose(fp); + printf("ӦϢɹ\n"); + return OK; +} + +// 湩Ӧ +Status Keep_suppliers(suppliers& head) +{ + FtraverseList_suppliers2(head, Save_suppliers); + return OK; +} + +// һյĴͷƷ +Status InitList_commodity(commodity& head, commodity& tail) +{ + head = (commodity)malloc(sizeof(goods)); + if (!head) + exit(OVERFLOW); + head->next = NULL; + tail = head; + return OK; +} + +// ƷβһƷ +Status ListAdd_commodity(commodity& tail, char id_Number[], char goods_Name[], char place[], + double buy_Prise, double sell_Prise, int remain_Number, int quality_Date, date purchase_Date, date produce_Date) +{ + commodity p; + p = (commodity)malloc(sizeof(goods)); + if (!p) + exit(OVERFLOW); + strcpy(p->id_Number, id_Number); + strcpy(p->goods_Name, goods_Name); + strcpy(p->place, place); + p->buy_Prise = buy_Prise; + p->sell_Prise = sell_Prise; + p->remain_Number = remain_Number; + p->quality_Date = quality_Date; + p->purchase_Date.year = purchase_Date.year; + p->purchase_Date.month = purchase_Date.month; + p->purchase_Date.day = purchase_Date.day; + p->produce_Date.year = produce_Date.year; + p->produce_Date.month = produce_Date.month; + p->produce_Date.day = produce_Date.day; + p->pre = tail; + p->next = NULL; + tail->next = p; + tail = p; + return OK; +} + +// ƷؼƥĹӦ̽ +Status ListHandle_commodity(commodity& head, commodity& p, char id_Number[]) +{ + p = head->next; + while (p) + { + if (strcmp(p->id_Number, id_Number) == 0) + { + break; + } + p = p->next; + } + return OK; +} + +// Ӵ¼ƷϢ +Status Add_commodity(commodity& head, commodity& tail, suppliers& suppliers_head, suppliers& suppliers_tail) +{ + commodity p; + suppliers suppliers_p; + char id_Number[20]; + char goods_Name[20]; + char place[20]; + char source[MAX_SIZE]; + char channel[MAX_SIZE]; + char main_business[MAX_SIZE]; + char main_products[MAX_SIZE]; + char brand[MAX_SIZE]; + char contact_person[MAX_SIZE]; + char telephone[MAX_SIZE]; + double buy_Prise; + double sell_Prise; + int quantity; + int quality_Date; + date purchase_Date; + date produce_Date; + bool flag = false; + printf("롰ƷšƷơڡԴӦ̣ƷۡƷۼۡڡڡλáԿոΪβ\n"); + while (1) + { + scanf("%s %s %d %d %d %s %s %d %lf %lf %d %d %d %d %s", + id_Number, goods_Name, &purchase_Date.year, &purchase_Date.month, &purchase_Date.day, source, channel, &quantity, + &buy_Prise, &sell_Prise, &produce_Date.year, &produce_Date.month, &produce_Date.day, &quality_Date, place); + if (getchar() == ' ') + { + flag = true; + } + ListHandle_commodity(head, p, id_Number); + if (p) + { + if (strcmp(p->goods_Name, goods_Name) != 0 || strcmp(p->place, place) != 0 + || p->buy_Prise != buy_Prise || p->sell_Prise != sell_Prise || p->quality_Date != quality_Date + || p->purchase_Date.year != purchase_Date.year || p->purchase_Date.month != purchase_Date.month || p->purchase_Date.day != purchase_Date.day + || p->produce_Date.year != produce_Date.year || p->produce_Date.month != produce_Date.month || p->produce_Date.day != produce_Date.day) + { + printf("š%sѴƷϢ\n", id_Number); + return ERROR; + } + p->remain_Number += quantity; + } + else + ListAdd_commodity(tail, id_Number, goods_Name, place, buy_Prise, sell_Prise, quantity, quality_Date, purchase_Date, produce_Date); + ListHandle_suppliers(suppliers_head, suppliers_p, source); + if (!suppliers_p) + { + printf("δҵ˾Ϊ%sĹӦ̣!\n", source); + printf("롰ӪҵӪƷƷơˡ绰\n"); + scanf("%s %s %s %s %s", main_business, main_products, brand, contact_person, telephone); + ListAdd_suppliers(suppliers_tail, source, main_business, main_products, brand, contact_person, telephone); + printf("ӦϢӳɹ\n"); + ListHandle_suppliers(suppliers_head, suppliers_p, source); + } + ListAdd_purchase(suppliers_p->purchase_tail, id_Number, goods_Name, source, channel, quantity, buy_Prise, purchase_Date); + if (flag == true) + { + break; + } + } + printf("ƷϢ¼ɹ\n"); + printf("Ϣ¼ɹ\n"); + return OK; +} + +// ļеƷϢ +Status Fadd_commodity(commodity& head, commodity& tail, suppliers& suppliers_head, suppliers& suppliers_tail) +{ + FILE* fp; + commodity p; + suppliers suppliers_p; + char id_Number[20]; + char goods_Name[20]; + char place[20]; + char source[MAX_SIZE]; + char channel[MAX_SIZE]; + char main_business[MAX_SIZE]; + char main_products[MAX_SIZE]; + char brand[MAX_SIZE]; + char contact_person[MAX_SIZE]; + char telephone[MAX_SIZE]; + double buy_Prise; + double sell_Prise; + int quantity; + int quality_Date; + date purchase_Date; + date produce_Date; + bool flag = false; + fp = fopen("commodity1.txt", "r"); + if (fp == NULL) + { + printf("Can not open the file!"); + exit(INFEASIBLE); + } + while (1) + { + fscanf(fp, "%s %s %d %d %d %s %s %d %lf %lf %d %d %d %d %s", + id_Number, goods_Name, &purchase_Date.year, &purchase_Date.month, &purchase_Date.day, source, channel, &quantity, + &buy_Prise, &sell_Prise, &produce_Date.year, &produce_Date.month, &produce_Date.day, &quality_Date, place); + if (fgetc(fp) == ' ') + { + flag = true; + } + ListHandle_commodity(head, p, id_Number); + if (p) + { + if (strcmp(p->goods_Name, goods_Name) != 0 || strcmp(p->place, place) != 0 + || p->buy_Prise != buy_Prise || p->sell_Prise != sell_Prise || p->quality_Date != quality_Date + || p->purchase_Date.year != purchase_Date.year || p->purchase_Date.month != purchase_Date.month || p->purchase_Date.day != purchase_Date.day + || p->produce_Date.year != produce_Date.year || p->produce_Date.month != produce_Date.month || p->produce_Date.day != produce_Date.day) + { + printf("š%sѴƷϢ\n", id_Number); + return ERROR; + } + p->remain_Number += quantity; + } + else + ListAdd_commodity(tail, id_Number, goods_Name, place, buy_Prise, sell_Prise, quantity, quality_Date, purchase_Date, produce_Date); + ListHandle_suppliers(suppliers_head, suppliers_p, source); + if (!suppliers_p) + { + printf("δҵ˾Ϊ%sĹӦ̣!\n", source); + printf("롰ӪҵӪƷƷơˡ绰\n"); + scanf("%s %s %s %s %s", main_business, main_products, brand, contact_person, telephone); + ListAdd_suppliers(suppliers_tail, source, main_business, main_products, brand, contact_person, telephone); + printf("ӦϢӳɹ\n"); + ListHandle_suppliers(suppliers_head, suppliers_p, source); + } + ListAdd_purchase(suppliers_p->purchase_tail, id_Number, goods_Name, source, channel, quantity, buy_Prise, purchase_Date); + if (flag == true) + { + break; + } + } + fclose(fp); + printf("ƷϢɹ\n"); + printf("Ϣɹ\n"); + return OK; +} + +// ӹӦϢ +Status Interface_add_suppliers(commodity& commodity_head, commodity& commodity_tail, + suppliers& suppliers_head, suppliers& suppliers_tail) +{ + int option; + bool flag = false; + system("cls"); + printf("ӹӦϢ\n1.Ӵ¼빩ӦϢ\n2.ļе빩ӦϢ\n3.һ\n4.\n"); + while (!flag) + { + scanf("%d", &option); + switch (option) + { + case 1: + Add_suppliers(suppliers_head, suppliers_tail); + break; + case 2: + Fadd_suppliers(suppliers_head, suppliers_tail); + break; + case 3: + Interface_suppliers_management(commodity_head, commodity_tail, suppliers_head, suppliers_tail); + flag = true; + break; + case 4: + Main_interface(commodity_head, commodity_tail, suppliers_head, suppliers_tail); + flag = true; + break; + default: + printf("룡\n"); + break; + } + } + return OK; +} + +// ӡӦϢ +Status Interface_print_suppliers(commodity& commodity_head, commodity& commodity_tail, + suppliers& suppliers_head, suppliers& suppliers_tail) +{ + int option; + bool flag = false; + system("cls"); + printf("ӡӦϢ\n1.ڴ¼ӦϢ\n2.ļеӦϢ\n3.һ\n4.\n"); + while (!flag) + { + scanf("%d", &option); + switch (option) + { + case 1: + DisplayList_suppliers(suppliers_head); + break; + case 2: + FdisplayList_suppliers(suppliers_head); + break; + case 3: + Interface_suppliers_management(commodity_head, commodity_tail, suppliers_head, suppliers_tail); + flag = true; + break; + case 4: + Main_interface(commodity_head, commodity_tail, suppliers_head, suppliers_tail); + flag = true; + break; + default: + printf("룡\n"); + break; + } + } + return OK; +} + +// ӦϢ +Status Interface_suppliers_management(commodity& commodity_head, commodity& commodity_tail, + suppliers& suppliers_head, suppliers& suppliers_tail) +{ + int option; + bool flag = false; + system("cls"); + printf("ӦϢ\n1.ӹӦϢ\n2.ɾӦϢ\n3.޸ĹӦϢ\n4.ѯӦϢ\n5.ӡӦϢ\n6.\n"); + while (!flag) + { + scanf("%d", &option); + switch (option) + { + case 1: + Interface_add_suppliers(commodity_head, commodity_tail, suppliers_head, suppliers_tail); + flag = true; + break; + case 2: + ListDelete_suppliers(suppliers_head); + break; + case 3: + ListAlter_suppliers(suppliers_head, suppliers_tail); + break; + case 4: + ListSearch_suppliers(suppliers_head, suppliers_tail); + break; + case 5: + Interface_print_suppliers(commodity_head, commodity_tail, suppliers_head, suppliers_tail); + flag = true; + break; + case 6: + Main_interface(commodity_head, commodity_tail, suppliers_head, suppliers_tail); + flag = true; + break; + default: + printf("룡\n"); + break; + } + } + return OK; +} + +// +Status Interface_purchase_management(commodity& commodity_head, commodity& commodity_tail, + suppliers& suppliers_head, suppliers& suppliers_tail) +{ + int option; + bool flag = false; + system("cls"); + printf("\n1.Ӵ¼ƷϢͽϢ\n2.ļеƷϢͽϢ\n3.\n"); + while (!flag) + { + scanf("%d", &option); + switch (option) + { + case 1: + Add_commodity(commodity_head, commodity_tail, suppliers_head, suppliers_tail); + break; + case 2: + Fadd_commodity(commodity_head, commodity_tail, suppliers_head, suppliers_tail); + break; + case 3: + Main_interface(commodity_head, commodity_tail, suppliers_head, suppliers_tail); + flag = true; + break; + default: + printf("룡\n"); + break; + } + } + return OK; +} + +// +Status Main_interface(commodity& commodity_head, commodity& commodity_tail, + suppliers& suppliers_head, suppliers& suppliers_tail) +{ + int option; + bool flag = false; + system("cls"); + printf("\n1.ӦϢ\n2.\n3.˳\n"); + while (!flag) + { + scanf("%d", &option); + switch (option) + { + case 1: + Interface_suppliers_management(commodity_head, commodity_tail, suppliers_head, suppliers_tail); + flag = true; + break; + case 2: + Interface_purchase_management(commodity_head, commodity_tail, suppliers_head, suppliers_tail); + flag = true; + break; + case 3: + Keep_suppliers(suppliers_head); + return OK; + default: + printf("룡\n"); + break; + } + } + return OK; +} diff --git a/code/purchase.h b/code/purchase.h new file mode 100644 index 0000000..0c61996 --- /dev/null +++ b/code/purchase.h @@ -0,0 +1,182 @@ +#include + +// ׼ͷļṹ +#ifndef __PURCHASE_H__ +#define __PURCHASE_H__ + +// +#define MAX_SIZE 30 + +// ״̬ +#define TRUE 1 // +#define FALSE 0 // +#define OK 1 // +#define ERROR 0 // +#define INFEASIBLE -1 // +#define OVERFLOW -2 // + +// Status ǺֵͣǺ״̬ +typedef int Status; + +// ʱṹ壬洢ꡢ¡Ϣ +struct date +{ + int year; // + int month; // + int day; // +}; + +/* ˫ĵڵ㣬ӦĽṹԱ */ + +// ϢԳеIJɹй洢Щʱ䡢Դ/۸Ϣ +typedef struct purchase_information +{ + char number[MAX_SIZE]; // Ʒ + char name[MAX_SIZE]; // Ʒ + char source[MAX_SIZE]; // Դ + char channel[MAX_SIZE]; // + int quantity; // + double price; // ۸ + date time; // ʱ + purchase_information* pre; // һָ + purchase_information* next; // һָ +}*purchase; + +// ӦϢ洢˾ơӪҵ/ƷƷơˡ绰Ϣ +typedef struct suppliers_information +{ + char corporate_name[MAX_SIZE]; // ˾ + char main_business[MAX_SIZE]; // Ӫҵ + char main_products[MAX_SIZE]; // ӪƷ + char brand[MAX_SIZE]; // Ʒ + char contact_person[MAX_SIZE]; // + char telephone[MAX_SIZE]; // 绰 + purchase purchase_head; // Ϣͷڵ + purchase purchase_tail; // Ϣβ + suppliers_information* pre; // һӦָ + suppliers_information* next; // һӦָ +}*suppliers; + +typedef struct goods +{ + char id_Number[20]; // Ʒ + char goods_Name[20]; // Ʒ + char place[20]; // λ + double buy_Prise; // Ʒ + double sell_Prise; // Ʒۼ + int remain_Number; // Ʒ + int quality_Date; // + date purchase_Date; // + date produce_Date; // + goods* pre; // һƷָ + goods* next; // һƷָ +}*commodity; + +// һյĴͷĽ˫ +Status InitList_purchase(purchase& head, purchase& tail); + +// ڽβһ +Status ListAdd_purchase(purchase& tail, char number[], char name[], char source[], char channel[], int quantity, double price, date time); + +// ڴ¼Ϣ +Status Printf_purchas(purchase& p); + +// ļеϢ +Status Fprintf_purchas(FILE* fp, purchase& p); + +// ڴбζÿڵúvisit()һvisit()ʧܣʧ +Status TraverseList_purchas(purchase& head, Status(*visit)(purchase& p)); + +// ļбζÿڵúvisit()һvisit()ʧܣʧ +Status FtraverseList_purchas(FILE* fp, purchase& head, Status(*visit)(FILE* fp, purchase& p)); + +// ڴ¼ +Status DisplayList_purchas(purchase& head); + +// ļе +Status FdisplayList_purchas(FILE* fp, purchase& head); + +// һյĴͷĹӦ˫ +Status InitList_suppliers(suppliers& head, suppliers& tail); + +// ҹӦ̹˾ؼƥĹӦ̽ +Status ListHandle_suppliers(suppliers& head, suppliers& p, char corporate_name[]); + +// ڹӦβһӦ̽ +Status ListAdd_suppliers(suppliers& tail, char corporate_name[], char main_business[], char main_products[], char brand[], char contact_person[], char telephone[]); + +// Ӵ¼빩ӦϢ +Status Add_suppliers(suppliers& head, suppliers& tail); + +// ļе빩ӦϢ +Status Fadd_suppliers(suppliers& head, suppliers& tail); + +// ɾӦ̹˾ؼƥĹӦ̽ +Status ListDelete_suppliers(suppliers& head); + +// ޸ĹӦ̹˾ؼƥĹӦ̽ +Status ListAlter_suppliers(suppliers& head, suppliers& tail); + +// ѯӦ̹˾ؼƥĹӦ̽㹩ӦϢ +Status ListSearch_suppliers(suppliers& head, suppliers& tail); + +// ڴӦϢ +Status Printf_suppliers(suppliers& p); + +// ļеӦϢ +Status Fprintf_suppliers(FILE* fp, suppliers& p); + +// ڴбӦζÿڵúvisit()һvisit()ʧܣʧ +Status TraverseList_suppliers(suppliers& head, Status(*visit)(suppliers& p)); + +// ļбӦζÿڵúvisit()һvisit()ʧܣʧ +Status FtraverseList_suppliers1(suppliers& head, Status(*visit)(FILE* fp, suppliers& p)); + +// ڴ¼Ӧ +Status DisplayList_suppliers(suppliers& head); + +// ļеӦ +Status FdisplayList_suppliers(suppliers& head); + +// 湩ӦϢ +Status Save_suppliers(FILE* fp, suppliers& p); + +// ļӦζÿڵúvisit()һvisit()ʧܣʧ +Status FtraverseList_suppliers2(suppliers& head, Status(*visit)(FILE* fp, suppliers& p)); + +// 湩Ӧ +Status Keep_suppliers(suppliers& head); + +// һյĴͷƷ +Status InitList_commodity(commodity& head, commodity& tail); + +// ƷβһƷ +Status ListAdd_commodity(commodity& tail, char id_Number[], char goods_Name[], char place[], + double buy_Prise, double sell_Prise, int remain_Number, int quality_Date, date purchase_Date, date produce_Date); + +// ƷؼƥĹӦ̽ +Status ListHandle_commodity(commodity& head, commodity& p, char id_Number[]); + +// Ӵ¼ƷϢ +Status Add_commodity(commodity& head, commodity& tail, suppliers& suppliers_head, suppliers& suppliers_tail); + +// ļеƷϢ +Status Fadd_commodity(commodity& head, commodity& tail, suppliers& suppliers_head, suppliers& suppliers_tail); + +// ӹӦϢ +Status Interface_add_suppliers(commodity& commodity_head, commodity& commodity_tail, + suppliers& suppliers_head, suppliers& suppliers_tail); + +// ӦϢ +Status Interface_suppliers_management(commodity& commodity_head, commodity& commodity_tail, + suppliers& suppliers_head, suppliers& suppliers_tail); + +// +Status Interface_purchase_management(commodity& commodity_head, commodity& commodity_tail, + suppliers& suppliers_head, suppliers& suppliers_tail); + +// +Status Main_interface(commodity& commodity_head, commodity& commodity_tail, + suppliers& suppliers_head, suppliers& suppliers_tail); + +#endif \ No newline at end of file diff --git a/code/suppliers1.txt b/code/suppliers1.txt new file mode 100644 index 0000000..7e80b65 --- /dev/null +++ b/code/suppliers1.txt @@ -0,0 +1,6 @@ +tengxun tengxun1 tengxun2 tengxun3 tengxun4 1111 +wangyi wangyi1 wangyi2 wangyi3 wangyi4 2222 +xiaomi xiaomi1 xiaomi2 xiaomi3 xiaomi4 3333 +huawei huawei1 huawei2 huawei3 huawei4 4444 +zhongxing zhongxing1 zhongxing2 zhongxing3 zhongxing4 5555 +sanxing sanxing1 sanxing2 sanxing3 sanxing4 6666 \ No newline at end of file diff --git a/code/suppliers2.txt b/code/suppliers2.txt new file mode 100644 index 0000000..e69de29 -- Gitee From 312a47e26cdadde368a0a97dd63c8823d4122ed4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=8F=E4=BA=8E=E6=98=8A?= <2074819354@qq.com> Date: Mon, 20 Jul 2020 22:30:53 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20co?= =?UTF-8?q?de/commodity2.txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/commodity2.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 code/commodity2.txt diff --git a/code/commodity2.txt b/code/commodity2.txt deleted file mode 100644 index d3f5a12..0000000 --- a/code/commodity2.txt +++ /dev/null @@ -1 +0,0 @@ - -- Gitee From 06bd27fbd803c822aace231f5be69088b0f831c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=8F=E4=BA=8E=E6=98=8A?= <2074819354@qq.com> Date: Mon, 20 Jul 2020 22:31:05 +0800 Subject: [PATCH 07/10] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20co?= =?UTF-8?q?de/suppliers2.txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/suppliers2.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 code/suppliers2.txt diff --git a/code/suppliers2.txt b/code/suppliers2.txt deleted file mode 100644 index e69de29..0000000 -- Gitee From 5c67403c0b195246e9d4fb25f849d90464e0fa7e Mon Sep 17 00:00:00 2001 From: hyp19991114 Date: Tue, 21 Jul 2020 16:58:14 +0800 Subject: [PATCH 08/10] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20co?= =?UTF-8?q?de/Project1.cpp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/Project1.cpp | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 code/Project1.cpp diff --git a/code/Project1.cpp b/code/Project1.cpp deleted file mode 100644 index 9034f27..0000000 --- a/code/Project1.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "purchase.h" -Status main() -{ - suppliers suppliers_head, suppliers_tail; - commodity commodity_head, commodity_tail; - InitList_suppliers(suppliers_head, suppliers_tail); - InitList_commodity(commodity_head, commodity_tail); - Main_interface(commodity_head, commodity_tail, suppliers_head, suppliers_tail); - return OK; -} -- Gitee From 83e95bef6845e225d545dd3df169e75aed4a7e9c Mon Sep 17 00:00:00 2001 From: hyp19991114 Date: Tue, 21 Jul 2020 17:00:59 +0800 Subject: [PATCH 09/10] update code/commodity1.txt. --- code/commodity1.txt | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/code/commodity1.txt b/code/commodity1.txt index 67ca69a..8c3e0c2 100644 --- a/code/commodity1.txt +++ b/code/commodity1.txt @@ -1,7 +1,12 @@ -001 apple 2020 7 14 wangyi qiang 100 5 6 2020 5 20 365 westroom -002 orange 2020 7 14 tengxun qiang 100 4 5 2020 6 10 90 westroom -003 banana 2020 7 14 sanxing qiang 100 9 10 2020 6 10 90 westroom -004 pear 2020 7 14 xiaomi qiang 100 5 6 2020 6 20 90 westroom +001 apple 2020 7 14 wangyi qiang 100 5 6 2020 6 20 365 westroom +002 orange 2020 6 14 tengxun qiang 80 4 5 2020 6 10 35 westroom +003 banana 2020 7 5 sanxing qiang 100 9 10 2020 7 2 15 westroom +004 pear 2020 6 30 xiaomi qiang 90 5 6 2020 6 20 90 westroom 005 watermelon 2020 7 14 tengxun qiang 100 6 7 2020 6 15 90 eastroom -006 peach 2020 7 14 huawei qiang 100 3 4 2020 6 20 90 eastroom -007 pen 2020 7 14 zhongxing qiang 100 1 2 2020 5 11 365 eastroom \ No newline at end of file +006 peach 2020 7 12 huawei qiang 100 3 5 2020 7 10 5 eastroom +007 pen 2020 7 14 zhongxing qiang 45 1 2 2020 5 11 365 eastroom +008 camera 2020 7 14 sanxing gift 10 500 650 2020 7 10 365 west-1A +009 computer 2020 6 10 huawei gift 30 3000 4000 2020 6 1 1000 west-1B +010 audio 2020 7 14 xiaomi buy 80 100 150 2020 7 5 180 east-1A +011 phone 2020 6 2 huawei buy 5 5000 6000 2020 6 1 700 east-1B +012 MP3 2020 7 14 zhongxing buy 100 50 70 2020 6 20 365 east-1C \ No newline at end of file -- Gitee From 70829f1495dadd189b09487c76a9be6b2e7dbe3f Mon Sep 17 00:00:00 2001 From: hyp19991114 Date: Tue, 21 Jul 2020 17:02:21 +0800 Subject: [PATCH 10/10] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20co?= =?UTF-8?q?de/commodity1.txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/commodity1.txt | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 code/commodity1.txt diff --git a/code/commodity1.txt b/code/commodity1.txt deleted file mode 100644 index 8c3e0c2..0000000 --- a/code/commodity1.txt +++ /dev/null @@ -1,12 +0,0 @@ -001 apple 2020 7 14 wangyi qiang 100 5 6 2020 6 20 365 westroom -002 orange 2020 6 14 tengxun qiang 80 4 5 2020 6 10 35 westroom -003 banana 2020 7 5 sanxing qiang 100 9 10 2020 7 2 15 westroom -004 pear 2020 6 30 xiaomi qiang 90 5 6 2020 6 20 90 westroom -005 watermelon 2020 7 14 tengxun qiang 100 6 7 2020 6 15 90 eastroom -006 peach 2020 7 12 huawei qiang 100 3 5 2020 7 10 5 eastroom -007 pen 2020 7 14 zhongxing qiang 45 1 2 2020 5 11 365 eastroom -008 camera 2020 7 14 sanxing gift 10 500 650 2020 7 10 365 west-1A -009 computer 2020 6 10 huawei gift 30 3000 4000 2020 6 1 1000 west-1B -010 audio 2020 7 14 xiaomi buy 80 100 150 2020 7 5 180 east-1A -011 phone 2020 6 2 huawei buy 5 5000 6000 2020 6 1 700 east-1B -012 MP3 2020 7 14 zhongxing buy 100 50 70 2020 6 20 365 east-1C \ No newline at end of file -- Gitee